<?php
// no direct access
defined('_JEXEC') or die;

require_once(JPATH_COMPONENT.DS.'controller.php');

if($controller = JRequest::getWord('controller'))
{
    $path = JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php';
    if (file_exists($path)) {
        require_once $path;
    }
    else
    {
        $controller = '';
    }
}

//Tao controller
$classname = 'HellochaoController'.$controller;
$controller=new $classname();

//Thuc thi cac nhiem vu duoc yeu cau
$controller->execute(JRequest::getVar('task'));

//JRquest::getVar('') lay gia tri bien task co the la GET hoac POST
//vidu: index.php?option=com_hello&task=new
//task co the mang gia tri "new", "save","edit","display"...
//neu khong co nhiem vu nao thi mac dinh la display
//khi "display" duoc su dung bien "view" quyet dinh hien thi cai gi
//Chuyen huong thiet lap boi controller

$controller->redirect();

?>
